package cn.sdxx.qddata.controller;

import cn.sdxx.qddata.common.R;
import cn.sdxx.qddata.entity.District;
import cn.sdxx.qddata.service.DistrictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "省-市-区District模块")
@Slf4j
@RestController
@RequestMapping("/district")
public class DistrictController {

    @Autowired
    private DistrictService districtService;


    @ApiOperation("根据地区码（code）查询该地区中包含的下一级地区")
    @GetMapping()
    public R getDistrictByParent(String code){
        List<District> resultList = districtService.getDistinctByParent(code);
        return R.success(resultList);
    }

}
